//
//  TextField.m
//  AddressBook
//
//  Created by dllo on 15/11/20.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "TextField.h"

@implementation TextField

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/


- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView {
    self.textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width / 2, 40)];
    self.textField.layer.borderWidth = 1;
    self.textField.layer.cornerRadius = 10;
    self.textField.textAlignment = 1;
    self.textField.delegate = self;
    self.textField.clearButtonMode = UITextFieldViewModeAlways;
    [self addSubview:self.textField];
}

- (void)textFieldDidEndEditing:(UITextField *)textField {
    [self.textField resignFirstResponder];
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [self.textField resignFirstResponder];
    return YES;
}



@end
